﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FubiManger.Controls
{
    ////ToolboxItem用于控制是否添加自定义控件到工具箱，true添加，false不添加
    //[System.ComponentModel.ToolboxItem(true)]
    partial class Edittimecontrol : Smobiler.Core.Controls.MobileUserControl
    {
        public Edittimecontrol() : base()
        {
            //This call is required by the SmobilerUserControl.
            InitializeComponent();
        }
        public string hour { get; set; }
        public string miniute { get; set; }
        private void btnclose_Press(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnok_Press(object sender, EventArgs e)
        {
            try
            {

                if (Convert.ToInt32(txthour.Text) > 0)
                {
                    hour = txthour.Text;
                    miniute = txtminiute.Text;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("请设置小时");
                }
            }
            catch (Exception)
            {

                MessageBox.Show("请正确填写参数");
            }

        }

        private void txtminiute_TouchLeave(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToInt32(txtminiute.Text) > 59)
                {
                    txtminiute.Text = "00";
                }
            }
            catch (Exception)
            {

                txtminiute.Text = "00";
            }
        }

        private void txthour_TouchLeave(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToInt32(txthour.Text) > 23)
                {
                    txthour.Text = "00";
                }
            }
            catch (Exception)
            {

                txthour.Text = "00";
            }
        }
    }
}